<template>
  <div style="margin-left: 20px">
    <Echart
        :options="options"
        id="bottomRightChart"
        height="480px"
        width="100%"
    ></Echart>
  </div>
</template>

<script>
import Echart from '@/common/echart'

export default {
  data() {
    return {
      options: {},
    };
  },
  components: {
    Echart,
  },
  props: {
    cdata: {
      type: Object,
      default: () => ({})
    },
  },
  watch: {
    cdata: {
      handler(newData) {
        this.options = {
          tooltip: {
            trigger: "axis",
            backgroundColor: "rgba(255,255,255,0.1)",
            axisPointer: {
              type: "shadow",
              label: {
                show: true,
                backgroundColor: "#7B7DDC"
              }
            }
          },
          legend: {
            data: ["本土", "境外"],
            textStyle: {
              color: "#B4B4B4"
            },
            top: "0%"
          },
          grid: {
            x: "8%",
            width: "100%",
            y: "10%",
            height: "80%"
          },
          xAxis: {
            data: newData.category,
            axisLine: {
              lineStyle: {
                color: "#B4B4B4"
              }
            },
            axisTick: {
              show: false
            },
            axisLabel: {
              interval:0,
              rotate:5
            }
          },
          yAxis: [
            {
              splitLine: {show: false},
              axisLine: {
                lineStyle: {
                  color: "#B4B4B4"
                }
              },

              axisLabel: {
                formatter: "{value} "
              },
              scale:true
            }
          ],
          series: [
            {
              name: "本土",
              type: "line",
              barGap: "-100%",
              barWidth: 10,
              itemStyle: {
                normal: {
                  color: "#FFA54F"
                }
              },
              z: -12,
              data: newData.lineData
            },
            {
              name: "境外",
              type: "line",
              barWidth: 10,
              itemStyle: {
                normal: {
                  color: "#FF3030"
                }
              },
              data: newData.barData
            }
          ]
        }
      },
      immediate: true,
      deep: true
    },
  },
}
</script>
